package com.fanxing.anno;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;

//@Anno10(className = "com.bobo.util.anno.Person",methodName = "show")
public class Test04 {
    public static void main(String[] args) throws Exception{
        Class<Test04> test04Class = Test04.class;
        Anno10 annotation = test04Class.getAnnotation(Anno10.class);
        if(annotation != null){
            String className = annotation.className();
            String methodName = annotation.methodName();
            Class<?> aClass = Class.forName(className);
            Method declaredMethod = aClass.getDeclaredMethod(methodName);
            Object o = aClass.newInstance();
            declaredMethod.invoke(o);
        }
    }
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@interface Anno10{

    String className();
    String methodName();

}

class Person {
    public void show(){
        System.out.println("show .... ");
    }
}
